package br.com.controller.professor;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

import br.com.arquitetura.controlador.AbstractMBean;
import br.com.arquitetura.excecoes.BDException;
import br.com.data.hibernate.AulaHibernateDAO;
import br.com.model.entidade.Aula;


@ManagedBean
@ViewScoped
public class MBVizualizarTurma extends AbstractMBean<Aula>{

	private static final long serialVersionUID = 1L;
	private Aula aula;
	private AulaHibernateDAO aulaHibernateDAO;

	public MBVizualizarTurma() {
		//Recuperando o id da turma da session
		HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
		Long aula_id = (Long) session.getAttribute("idAulaVizualizacao");
		System.out.println(aula_id);
		this.aulaHibernateDAO = (AulaHibernateDAO) getBean("aulaHibernateDAO");
		
		try {
			aula = aulaHibernateDAO.getById(Aula.class, aula_id);
		} catch (BDException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		
	}
	
	public void irCadastrarDiario(){
		
		
	}
	


	public Aula getAula() {
		return aula;
	}


	public void setAula(Aula aula) {
		this.aula = aula;
	}


	
	
	
}
